<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 5rem;
        height: 5rem;
        background: blueviolet;
      }
    </style>
  </head>
  <body>
    <div>嘻嘻</div>
    <script>
      var htmlEle = document.querySelector("html");
      function change() {
        var w = window.innerWidth / 10;
        htmlEle.style.fontSize = `${w}px`;
      }
      change();
      window.onresize = function () {
        change();
      };
    </script>
  </body>
</html>
